<template>
    <div class="listViewTop">
        <img class="bg" :src="playlists.coverImgUrl" alt="">
        <div class="listViewTopNav">
            <div class="back" @click="$router.go(-1)">
                <svg class="icon back" aria-hidden="true">
                    <use xlink:href="#icon-zuojiantou"></use>
                </svg>
                <div class="title">
                    歌单
                </div>
            </div>
            <div class="right">
                <svg class="icon search" aria-hidden="true">
                    <use xlink:href="#icon-sousuo"></use>
                </svg>
                <svg class="icon search" aria-hidden="true">
                    <use xlink:href="#icon-liebiao"></use>
                </svg>
            </div>
        </div>
        <div class="content">
            <div class="content-left">
                <img :src="playlists.coverImgUrl" alt="">
                <div class="count">
                    <svg class="icon play" aria-hidden="true">
                        <use xlink:href="#icon-24gl-play"></use>
                    </svg>
                    <span>{{ changeValue(playlists.playCount) }}</span>
                </div>
            </div>
            <div class="content-right">
                <h4>{{ playlists.name }}</h4>
                <div class="author">
                    <img :src="playlists != null && JSON.stringify(playlists) != '{}' ? playlists.creator.avatarUrl : ''"
                        alt="">
                    <span>{{ playlists!= null && JSON.stringify(playlists) != '{}' ? playlists.creator.nickname : ''
                    }}</span>
                    <svg class="icon play" aria-hidden="true">
                        <use xlink:href="#icon-youjiantou"></use>
                    </svg>
                </div>
                <div class="description">
                    <div class="description-dep"> {{ playlists!= null && JSON.stringify(playlists) != '{}' ?
                    playlists.description : '' }}</div>
                    <div class="description-icons">
                        <svg class="icon play" aria-hidden="true">
                            <use xlink:href="#icon-youjiantou"></use>
                        </svg>
                    </div>

                </div>
            </div>
        </div>
        <div class="iconList">
            <div class="iconItem">
                <svg class="icon de" aria-hidden="true">
                    <use xlink:href="#icon-pinglun"></use>
                </svg>
                <span>{{ playlists.commentCount }}</span>
            </div>
            <div class="iconItem">
                <svg class="icon de" aria-hidden="true">
                    <use xlink:href="#icon-fenxiang"></use>
                </svg>
                <span>{{ playlists.shareCount }}</span>

            </div>
            <div class="iconItem">
                <svg class="icon de" aria-hidden="true">
                    <use xlink:href="#icon-tianchongxing-"></use>
                </svg>
                <span>下载</span>

            </div>
            <div class="iconItem">
                <svg class="icon de" aria-hidden="true">
                    <use xlink:href="#icon-show_duoxuan"></use>
                </svg>
                <span>多选</span>

            </div>
        </div>
    </div>
</template>

<script>
import { reactive, toRefs } from 'vue'
import { changeValue } from '@/util/index.js'
export default {
    name: 'listviewTop',
    props: ['playlists'],
    setup(props) {
        const state = reactive({
            count: 0,
        })
        return {
            ...toRefs(state),
            changeValue,
            ...toRefs(props)
        }
    },
}
</script>

<style lang="less" scoped>
.listViewTop {
    width: 7.5rem;
    padding: 0 0.4rem;
    min-height: 5rem;

    .bg {
        position: fixed;
        left: 0;
        top: 0;
        width: 7.5rem;
        height: auto;
        z-index: -1;
        filter: blur(40px);
    }

    .listViewTopNav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 1.2rem;
        font-size: 0.35rem;

        .icon {
            width: 0.5rem;
            height: 0.5rem;
            color: #fff;
            fill: #fff;
        }

        .title {
            margin-left: 0.4rem;
        }

        .search {
            margin-right: 0.5rem;
        }

        .back,
        .right {
            display: flex;
            color: #fff;
            align-items: center;

        }
    }

    .content {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0.4rem;
        &-left {
            height: auto;
            width: 35%;
            position: relative;

            img {
                border-radius: 0.2rem;
                width: 100%;
            }

            .count {
                position: absolute;
                right: 0.1rem;
                top: 0.1rem;
                font-size: 0.24rem;
                display: flex;
                align-items: center;
                color: #fff;
                font-weight: 200;

                .play {
                    color: #fff;
                    margin-right: 3px;
                    font-size: 0.1rem;
                }
            }
        }

        &-right {
            height: 2.3rem;
            width: 60%;

            h4 {
                color:rgba(255, 255, 255,0.8);
                margin-bottom: 8px;
            }

            .author {
                display: flex;
                align-items: center;
                justify-content: flex-start;
                margin-bottom: 5px;
                color: rgba(0,0,0,0.7);
                img {
                    width: 0.5rem;
                    border-radius: 50%;
                    margin-right: 5px;
                }
            }

            .description {

                font-size: 0.18rem;
                display: flex;
                justify-content: center;
                align-items: flex-start;
                color: rgba(0,0,0,0.4);
                &-dep {
                    word-break: break-all;
                    text-overflow: ellipsis;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 2;
                    overflow: hidden;
                    display: -webkit-box;
                }
            }
        }
    }
    .iconList{
        width: 7.1rem;
        height: 1rem;
        // background-color: antiquewhite;
        display: flex;
        justify-content: space-around;
        align-items: center;
        margin-bottom: 0.4rem;
        .iconItem{
            display: flex;
            flex-direction: column;
            align-items: center;
            color: rgba(255, 255, 255);
            .de{
                width: 0.8rem;
                height: 0.4rem;
            }
        }
    }
}
</style>